package com.itstyle.seckill.topic.jichu;

import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @Auther: liuwenxiang
 * @Date: 2020/3/15 22:21
 * @Description:
 */
public class TestExcutorPool {

    private static ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(10,100,10,TimeUnit.SECONDS,new LinkedBlockingQueue<>(1000));

    public static void main(String[] args) {
        //Executors工具类，Executor线程池的顶层接口,ThreadPoolExecutor基本实现
        //ThreadPoolExecutor
        /**
         * 创建线程池的方式：
         *  1.Executors工具类获取，里面还是通过ThreadPoolExecutor实现，不同的线程池区别在于阻塞队列的不同。
         *  2.通过ThreadPoolExecutor手动创建。--推荐手段创建，根据实际情况设置池大小，对资源可控。
         */
        //Executors.newFixedThreadPool(1);
        //Executors.newCachedThreadPool();
        //Executors.newSingleThreadExecutor();
        //Executors.newScheduledThreadPool(10);
        //Executors.newSingleThreadScheduledExecutor();


    }
}
